package com.hilinos.base.api.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.hilinos.common.common.ReturnCode;
import com.hilinos.common.entity.BaseEntity;
import com.hilinos.common.entity.IBaseVo;
import com.hilinos.common.entity.QoFieldIgnore;
import com.hilinos.common.util.AssertUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class AccountAddVo extends BaseEntity implements IBaseVo {

    @ApiModelProperty(value = "用户账号Id", readOnly = true, hidden = true)
    @TableField("account_id")
    private String accountId;

    @ApiModelProperty(value = "用户账号加密字符串", readOnly = true, hidden = true)
    @TableField("account_secret")
    @QoFieldIgnore
    private String accountSecret;

    @ApiModelProperty(value = "平台ID", readOnly = true, hidden = true)
    @TableField("appid")
    private String appid;

    @ApiModelProperty(value = "用户账号加密字符串额外参数", readOnly = true, hidden = true)
    @TableField("account_secret_extra")
    @QoFieldIgnore
    private String accountSecretExtra;

    @ApiModelProperty("账户类型;如：微信，小程序等")
    @TableField("account_type")
    private String accountType;
    @ApiModelProperty("用户_id")
    @TableField("user_id")
    private String userId;
    @ApiModelProperty("账户状态")
    @TableField("account_status")
    private Integer accountStatus;
    @ApiModelProperty("账户过期时间;为空表示永不过期，过期后，账户状态变更为停用")
    @TableField("account_exp_time")
    private String accountExpTime;

    @Override
    public void checkParams() {
        AssertUtils.isNotEmpty(accountId, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("用户ID不能为空"));
    }

    public void checkCreateParams() {
        checkParams();
        AssertUtils.isNotEmpty(accountId, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("账号不能为空"));
        AssertUtils.isNotEmpty(accountSecret, ReturnCode.NORMAL_PARAM_LOST_ERROR.respMsg("用户账号加密字符串不能为空"));
    }

    public void checkBindParams() {
        checkCreateParams();
    }
}
